# @Version:1.0
# @Author：green-citrus

# class Dog:
#     name = "波斯猫"
#     age = 2
#
#     def info(self, name):
#         print(f"name信息：{name}") # 加菲猫
#         # 通过 self.属性名 可以访问 对象的属性/成员变量
#         print(f"属性name: {self.name}") # 波斯猫
#
# dog = Dog()
# dog.info("加菲猫")

# class Dog:
#     name = "藏獒"
#     age = 2
#
#     def info(self, name):
#         print(f"name信息->{name}")
#
#     # 1.通过 @staticmethod 可以将方法转为静态方法
#     # 2.如果是一个静态方法，可以不带 self
#     # 3.静态的方法的调用形式有变化
#     @staticmethod
#     def ok():
#         print("ok...")
#
# dog = Dog()
# dog.info("德牧")
#
# # 调用静态方法
# # 方式1：通过对象调用
# dog.ok()
#
# # 方式2：通过类名调用
# Dog.ok()

# class Dog:
#     name = "藏獒"
#     age = 2
#
#     def hi(self):
#         print(f"hi self: {id(self)}")
#
# dog2 = Dog()
# print(id(dog2))
# dog2.hi()
# print('-'*30)
#
# dog3 = Dog()
# print(id(dog3))
# dog3.hi()

# class Dog:
#     name = "藏獒"
#     age = 2
#
#     def eat(self):
#         print(f"{self.name} 饿了...") # 中华田园犬 饿了...
#
#     def cry(self, name):
#         print(f"{name} is crying") # 金毛 is crying
#         print(f"{self.name} is crying") # 中华田园犬 is crying
#         self.eat()
#         # 不能直接调用
#         # eat()
#
# dog = Dog()
# dog.name = "中华田园犬"
# dog.cry("金毛")

class Person:
    name = None
    age = None

    def compare_to(self, person):
        return self.name == person.name and self.age == person.age

p1 = Person()
p1.name = "jack"
p1.age = 18

p2 = Person()
p2.name = "tom"
p2.age = 2

print(p1.compare_to(p2))
